//! RT-THREAD & RUST
//!
//! A simple and easy-to-use system support library
//! that provides basic functions and FS, NET and DEVICE.
//!
//! You can use this library on embedded devices that support rt-thread
//!
//! You can specify a function for “ C ” to call
//!
//! # Example
//! ```
//! #![no_std]
//!
//! use rtt_rs::*;
//! entry!(main);
//! fn main() { /*.....*/ }
//!
//! ```

#![no_std]
#![feature(alloc_error_handler)]
#![cfg(not(test))]
#![allow(dead_code)]
#[global_allocator]

static GLOBAL: mm::RttAlloc = mm::RttAlloc;

pub extern crate alloc;

pub mod mm;
pub mod out;
pub mod thread;
pub mod base;
pub mod mutex;
pub mod queue;
pub mod semaphore;

pub mod device;
pub mod fs;
pub mod net;

mod prelude;
pub use prelude::*;

/// This macro is used to indicate the entry function of the system
///
/// # Example
/// ```
/// use rtt_rs::*;
///
/// /* rtthread will call function main */
/// entry!(main);
///
/// fn main(){
///     /* ..... */
/// }
/// ```
#[macro_export]
macro_rules! entry {
	($func: ident) => {
		#[no_mangle]
		pub extern "C" fn rust_main() -> i8 {
		    crate::base::rttbase_init();
			$func();
			0
		}
	};
}